import axios from '@/utils/request'
import Cookies from 'js-cookie'

let api = {

  /**
   * 登录管理
   */
  login(params) {
    let { username, password } = params;
    let data = axios.post('/sys/manager/login', params);
    return data;
  },
  logout(params) {
    let data = axios.post('/sys/manager/logout', params)
    return data;
  },
  editPassword(params) {
    let data = axios.put('/sys/manager/reset/pwd', params)
    return data;
  },
  // 创建子账号
  addSystem(params) {
    let data = axios.post('/sys/manager/sub/account', params)
    return data;
  },

  /**
   *  激活码
   * @param  {[type]} params [description]
   * @return {[type]}        [description]
   */

  // 获取激活码列表
  getActiveCodeList(params) {
    let data = axios.get('/sys/active/code/list', params)
    return data;
  },


  // 生成激活码列表
  postCodeGenerate(params) {
    let data = axios.post('/sys/active/code/generate', params)
    return data;
  },

  // 批量导出列表
  postActiveCodeExport(params) {
    let data = axios.get('/sys/active/code/export', params)
    return data;
  },

  /**
   *  用人单位
   * @param  {[type]} params [description]
   * @return {[type]}        [description]
   */

  // 用人单位列表
  getEmployerList(params) {
    let data = axios.get('/sys/employer/list', params)
    return data;
  },
  // 用人单位招聘列表
  getEmployerJobList(params) {
    let data = axios.get('/sys/employer/'+params.eid+'/recruit/job/list', params)
    return data;
  },

  // 用人单位招聘详情
  getEmployerJobDetail(params) {
    let data = axios.get('/sys/employer/recruit/job/'+params.id, params)
    return data;
  },
    // 用人单位详情
  getEmployerDetail(params) {
    let data = axios.get('/sys/employer/'+params.id, params)
    return data;
  }, 
   /**
   *  老师
   * @param  {[type]} params [description]
   * @return {[type]}        [description]
   */
    // 老师列表
  getTeacherList(params) {
    let data = axios.get('/sys/teacher/list', params)
    return data;
  },
    // 导师下的学生列表
  getTeacherStudentList(params) {
    let data = axios.get('/sys/teacher/'+params.tid+'/student/list', params)
    return data;
  },
   // 导师详情
  getTeacherDetail(params) {
    let data = axios.get('/sys/teacher/'+params.tid, params)
    return data;
  },

  /**
   *  学生
   * @param  {[type]} params [description]
   * @return {[type]}        [description]
   */
    // 学生列表
  getStudentList(params) {
    let data = axios.get('/sys/student/list', params)
    return data;
  },
   // 学生详情
  getStudentDetail(params) {
    let data = axios.get('/sys/student/'+params.sid, params)
    return data;
  },
}

export default api


// export function login(username, password) {
//   return request({
//     url: '/sys/suser/login?username='+username+'&password='+password,
//     method: 'post'
//   })
// }

// export function getInfo(token) {
//   return request({
//     url: '/sys/suser/info',
//     method: 'get',
//     params: { token }
//   })
// }

// export function logout() {
//   return request({
//     url: '/sys/suser/logout',
//     method: 'post'
//   })
// }
